{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}

{% block title %}语音识别模型基准测试系统{% endblock %}

{% block page_content %}
<div class="page-header">
    <p>项目目录：{{ sc['dire'] }}</p>
    <p>python库所在的目录：{{ sc['python_lib_dir'] }}</p>
    <p>数据集集中所在的目录：{{ sc['dataset_source_dir'] }}</p>
    <p>系统ip：{{ sc['ip'] }}，端口：{{ sc['port'] }} <a href="{{ sc['ip'] }}:{{ sc['port'] }}">访问系统</a></p>
    <p>系统最大的可用内存空间：{{ sc['host_max_available_mem'] }}MB</p>
    <p>TensorFlow版本：{{ sc['tf_version'] }}</p>
    <p>PyTorch版本：{{ sc['torch_version'] }}</p>
    <p>Python版本：{{ sc['python_version'] }}</p>
    <p>MySQL版本：{{ sc['mysql_version'] }}</p>
    <p>Celery版本：{{ sc['celery_version'] }}</p>
    <p>基于TensorFlow的模型对象所属的类名：<br>{% for kmt in sc['keras_model_type_'+sc['tf_version']] %}
        {{ kmt }}&nbsp;&nbsp;&nbsp;&nbsp;<a href="{{ url_for('.kmt_delete',name=kmt) }}">删除该项</a><br>
        {% endfor %}
        <span id="add_kmt_button_span"><a href="javascript:void(0);" onclick="show_finish_add_kmt();"><button>+</button></a></span><span id="show_finish_add_kmt_span"></span>
    </p>
    <p>基于Pytorch的模型对象所属的类名：<br>{% for pmt in sc['pytorch_model_type'] %}
        {{ pmt }}&nbsp;&nbsp;&nbsp;&nbsp;<a href="{{ url_for('.pmt_delete',name=pmt) }}">删除该项</a><br>
        {% endfor %}
        <span id="add_pmt_button_span"><a href="javascript:void(0);" onclick="show_finish_add_pmt();"><button>+</button></a></span><span id="show_finish_add_pmt_span"></span>
    </p>
    <a class="btn btn-default" href="{{ url_for('.config_edit') }}">修改</a>
    <script type="text/javascript">
        function show_finish_add_kmt(){
            $('#add_kmt_button_span').html('');
            $('#show_finish_add_kmt_span').html('<input id="kmt_input" style="width:200px;"><a href="javascript:void(0);" onclick="add_kmt();"><button>完成</button></a>');
        }

        function add_kmt(){
            if ($('#kmt_input').val().length==0)return;
            $.ajax({
                type:'GET',
                url:'/add_kmt?kmt='+$('#kmt_input').val(),
                success:function(data,status,request){
                    html_content=kmt+'&nbsp;&nbsp;&nbsp;&nbsp;<a href="/kmt_delete?name='+kmt+'">删除该项</a><br>';
                    $('#add_kmt_button_span').before(html_content);
                },
                error:function(){
                    alert('请求添加基于TensorFlow的模型对象所属的类名的过程中出现错误');
                }
            });
            $('#add_kmt_button_span').html('<a href="javascript:void(0);" onclick="show_finish_add_kmt();"><button>+</button></a>');
            $('#show_finish_add_kmt_span').html('');
        }

        function show_finish_add_pmt(){
            $('#add_pmt_button_span').html('');
            $('#show_finish_add_pmt_span').html('<input id="pmt_input" style="width:200px;"><a href="javascript:void(0);" onclick="add_pmt();"><button>完成</button></a>');
        }

        function add_pmt(){
            if ($('#pmt_input').val().length==0)return;
            $.ajax({
                type:'GET',
                url:'/add_pmt?pmt='+$('#pmt_input').val(),
                success:function(data,status,request){
                    html_content=kmt+'&nbsp;&nbsp;&nbsp;&nbsp;<a href="/pmt_delete?name='+pmt+'">删除该项</a><br>';
                    $('#add_pmt_button_span').before(html_content);
                },
                error:function(){
                    alert('请求添加基于Pytorch的模型对象所属的类名的过程中出现错误');
                }
            });
            $('#add_pmt_button_span').html('<a href="javascript:void(0);" onclick="show_finish_add_pmt();"><button>+</button></a>');
            $('#show_finish_add_pmt_span').html('');
        }
    </script>
</div>

{% endblock %}